<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="../../include/easyui.jsp" %>
<%@ include file="../../include/pGrid.jsp" %>
<title>流程管理</title>
<script>
	$(function(){
		/*标记列表为树形*/
		p.isTreeGrid = true;
		p.dataGrid = $(p.dataGrid).treegrid($.extend({},p.dataGridParam,{
			columns: [[
		         {field:"flowName", width:200, title:"流程（节点）名称" },
		         {field:"flowCode", width:180, title:"流程编码" },
		         {field:"flowOrder", width:100, title:"流程排序"},
		         {field:"activeUserNames", width:120, title:"节点处理人"}
			]],
			idField: "treeId", 
			treeField: "flowName",
			sortName:"flowOrder",
			queryParams:{isTreeGrid:"true", treeId:"id", treePid:"parentId" },
			onSelect:function(row){
				if(row.parentId=='0'){
					$("a[motion_code=01]").linkbutton('enable'); return ;
				}else{
					$("a[motion_code=01]").linkbutton('disable'); return ;
				}
			}
		}));
		
		$("#toolbar .easyui-linkbutton").on("click", function() {
			var id = $(this).attr("motion_code");
			var flag = $(this).hasClass("l-btn-disabled");
			if(flag) return ;
			switch(id){
				case "01":
					var rows = p.dataGrid.datagrid('getSelections'), len = rows.length;
					var data = {pflowName : "无", parentId: 0}; 
					if(len>0){
						data = { parentId: rows[0].id || "" , pflowName: rows[0].flowName || "无"};
					}
					p.gridAdd({ title : "流程新增", width : 800, height : 420,data: data });
					break;
				case "02":
					p.gridModify({title : "流程编辑" ,width : 800, height : 420});
					break;
				case "03":
					p.gridDelete({});
					break;
				case "05":
					p.gridQuery();
					break;
				default: 
					p.tip({msg: $(this).text() +'未添加响应事件！'}); break;
			}
		});
	});
</script>
</head>
<body class="easyui-layout">
	<!-- 但行高度33px，多行时 33乘以行数  -->
	<div data-options="region:'north',split:false,border:false" style="height:33px;">
		<div class="easyui-panel" data-options="fit:true,border:false"  >
			<form id="queryForm">
				<input type="hidden" name="className" value="com.fs.jzzn.pojo" />
				<div style="margin-top:5px;margin-left:10px;float:left;">
					<input class="easyui-textbox" name="flowName" style="width:240px;" data-options="label:'流程名称:',required:false" />
					<input type="hidden" name="flowName_searchType" value="like" />
				</div>
				<div style="margin-top:5px;margin-left:10px;float:left;">
					<input class="easyui-textbox" name="flowCode" style="width:240px;" data-options="label:'节点编号:',required:false" />
					<input type="hidden" name="flowCode_searchType" value="like" />
				</div>
			</form>		
		</div>
	</div>  

	<!-- 工具栏 -->
	<div id="toolbar" class="easyui-panel" style="padding:3px;"></div>
	
	<!-- 表格 --> 
	<div region="center" border="false">
		<table id="dataGrid"></table>
	</div>
</body>
</html>